Methods and apparatus for an analog rotational sensor having magnetic sensor elements

ABSTRACT

A sensor includes a magnetic position sensing element to generate angular position information, a first signal generator, a second signal generator, a first inverter to invert the first waveform for providing a first inverted waveform and a second inverter to invert the second waveform for providing a second inverted waveform, wherein the first and second waveforms are inverted about an offset voltage, and an analog signal processing module to generate a linear output signal from the first waveform, the second waveform, the first inverted waveform, and the second inverted waveform.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 12/748,496, filed Mar. 29, 2010, which is a continuation ofU.S. patent application Ser. No. 11/425,567, now U.S. Pat. No.7,714,570, filed Jun. 21, 2006, both of which are incorporated herein byreference by its entirety.

STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH

Not Applicable.

BACKGROUND

As is known in the art, there are a variety of rotational sensors fordetermining angular position. In one type of sensor, Hall effect modulesare used to generate sine and cosine signals from which angular positioncan be determined. Such sensors use digital processing to process thesine and cosine signals generated from the Hall cells. Due to analog todigital signal conversion and other factors, such digital processingimposes limitations on the speed and accuracy of angular positiondetermination.

For example, part number AS5043 from Austria Microsystems is an angularposition sensor that digitally processes information from a Hall arrayusing a coordinate rotational digital computer (CORDIC) that implementsan iterative calculation for complex math with a lookup table. Othersensors use similar digital processing to implement various processingalgorithms for computing position information.

SUMMARY

The present invention provides a rotational sensor that generates alinear output from phase-shifted waveforms generated by magnetic sensorsusing analog signal processing. In one embodiment, the sensor isprovided on a single substrate. With this arrangement, an efficient andcost effective sensor is provided. While the invention is shown anddescribed in exemplary embodiments as having particular circuit andsignal processing implementations, it is understood that the inventionis applicable to a variety of analog processing techniques,implementations, and algorithms that are within the scope of theinvention.

In one aspect of the invention, a sensor includes a signal generationmodule including a magnetic sensor to provide position information forgenerating first and second waveforms corresponding to the positioninformation. An optional signal inversion module can be coupled to thesignal generation module for inverting the first waveform to provide afirst inverted waveform and for inverting the second waveform to providea second inverted waveform. An analog signal processing module can becoupled to the optional signal inversion module for providing analgebraic manipulation of a subset of the first waveform, the secondwaveform, the first inverted waveform, and the second inverted waveform,from the signal inversion module and generating a linear position outputvoltage signal.

Embodiments of the sensor can include various features. For example, thesignal inversion module can output the first and second waveforms in afirst region and output the first and second inverted waveforms in asecond region, wherein the second region corresponds to a position rangein which output would be non-linear without inversion of the first andsecond waveforms. A region indicator bit can indicate position range inthe first or second region. The first region can span about one hundredand eighty degrees. The first region can correspond to −sin(θ)>cos(θ)where −sin(θ) refers to the inversion of the sine wave about an offsetvoltage, sin(θ) and cos(θ) embody the amplitudes and offsets associatedwith the sinusoids, and θ indicates an angle of a rotating magnet in themagnetic sensor. The first region can correspond to a range for θ ofabout 315 degrees to about 135 degrees. The output in the first regioncan defined by

${output} = \frac{{A\mspace{11mu}{\sin(\theta)}} + {offset}}{\frac{1}{k}\left( {{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}} \right)}$where θ indicates an angle of a rotating magnet in the magnetic sensor,offset is a vertical offset of the first and second waveforms withrespect to ground, A is an amplitude of the first and second waveforms,and k is a real number affecting gain and vertical offset of the output.The signal processing module can include an analog multiplier. Thesensor can be provided on a single substrate. The sensor can include amagnet having a plurality of pole-pairs to increase waveform frequencyfor reducing maximum angular error.

In another aspect of the invention, a sensor includes a magneticposition sensing element to generate angular position information, afirst signal generator to generate a first waveform corresponding to theangular position information, a second signal generator to generate asecond waveform corresponding to the angular position information,wherein the first and second waveforms are offset by a predeterminedamount. The sensor can further include a first inverter to invert thefirst waveform for providing a first inverted waveform and a secondinverter to invert the second waveform for providing a second invertedwaveform, wherein the first and second waveforms are inverted about anoffset voltage, and an analog signal processing module to generate alinear output signal from the first waveform, the second waveform, thefirst inverted waveform, and the second inverted waveform.

The sensor can include one or more of various features. The first andsecond waveforms can be used by the signal processing module in a firstregion and the first inverted waveform and the second inverted waveformbeing used in second region to generate the linear output signal. Thefirst region can correspond to about 180 degrees of angular position forthe position sensing element. A region indicator can indicate a first orsecond region of operation.

In a further aspect of the invention, a sensor includes a signalgenerator means including a position sensor, a signal inversion meanscoupled to the signal generator means, and an analog signal processingmeans coupled to the signal inversion means to generate an output signalcorresponding to angular position of the position sensor. In oneembodiment, the sensor is provided on a single substrate.

In another aspect of the invention, a method includes providing a signalgenerator module including a magnetic position sensing element, couplinga signal inversion module to the signal generator module, and couplingan analog signal processing module to the signal inversion module togenerate a linear output signal corresponding to information from theposition sensing element.

The method can include one or more of providing the signal generatormodule, the signal inversion module, and the signal processing module ona single substrate, and generating first and second waveformscorresponding to the information from the position sensing element andinverting the first and second waveforms to generate the linear outputsignal.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing features of this invention, as well as the inventionitself, may be more fully understood from the following description ofthe drawings in which:

FIG. 1 is a block diagram of an exemplary analog angle sensor inaccordance with the present invention;

FIG. 1A is a pictorial representation of a Hall element that can form apart of a sensor in accordance with the present invention;

FIG. 2 is a graphical depiction of modeled sine and cosine signals, anaverage of the sine and cosine signals, and an output signal based uponthe relationships of Equation 1;

FIG. 3 is a graphical depiction of modeled sine, cosine, average, andoutput signals with an inverted region;

FIG. 4 is a graphical depiction showing a region indicator signal forlinear and non-linear output regions;

FIG. 5 is an exemplary circuit implementation of an analog angle sensorin accordance with the present invention;

FIG. 6 is a circuit diagram of a signal generation portion of thecircuit of FIG. 5;

FIG. 7 is a circuit diagram of a signal inversion portion of the circuitof FIG. 5;

FIG. 8 is a circuit diagram of a signal processing portion of thecircuit of FIG. 5; and

FIG. 9 is a pictorial representation of an exemplary sensor package inaccordance with the present invention;

FIG. 9A is a block diagram of a sensor having first and second dies;

FIG. 10 is a graphical depiction of signals generated by an angle sensorin accordance with exemplary embodiments of the invention;

FIG. 11 is a pictorial representation of a ring magnet and sensors andsine and cosine signals;

FIG. 11A is a pictorial representation of a multi-pole magnet in a donutshape that can generate sine and cosine signals;

FIG. 12 is a graphical depiction of signals generated by the arrangementof FIG. 11;

FIG. 13 is a pictorial representation of a ring magnet and sensors andsine and cosine signals;

FIG. 14 is another pictorial representation of a ring magnet and sensorsand sine and cosine signals;

FIG. 15 is a graphical depiction of signals including ramps generatedover one period of the sinusoidal signal;

FIG. 16 is a graphical depiction of a first region decoder bit;

FIG. 17 is a graphical depiction of a second region decoder bit;

FIG. 18 is a circuit diagram of an exemplary implementation;

FIG. 19 is a graphical depiction of a simulation of the circuit of FIG.18;

FIG. 20 is a graphical depiction of complementary waveform averaging;

FIG. 21 is a circuit diagram of an exemplary implementation of waveformaveraging;

FIG. 22 is a pictorial representation of two offset Hall elements andgenerated signals;

FIG. 23 is a graphical depiction of a first signal processing step;

FIG. 24 is a graphical depiction of a second signal processing step;

FIG. 25 is a graphical depiction of a third signal processing step;

FIG. 26 is a graphical depiction showing input gain factor, input angleand output angle;

FIG. 27 is a circuit diagram showing an exemplary implementation;

FIG. 28 is a circuit diagram showing further exemplary implementation ofthe circuit of FIG. 27;

FIG. 29 is a graphical depiction of a first signal processing step;

FIG. 30 is a graphical depiction of a second signal processing step;

FIG. 31 is a graphical depiction of a third signal processing step;

FIG. 32 is a graphical depiction of a fourth signal processing step;

FIG. 33 is a graphical depiction of a fifth signal processing step;

FIG. 34 is a graphical depiction of a sixth signal processing step;

FIG. 35 is a circuit diagram of an exemplary implementation;

FIG. 36 is a graphical depiction of a simulated output for the circuitof FIG. 35;

FIG. 37 is a schematic representation of an AGC and/or AOA timingcircuit; and

FIG. 38 is a graphical depiction of signals in the circuit of FIG. 37.

DETAILED DESCRIPTION

FIG. 1 shows an analog position sensor 100 having a signal generationmodule 102 to generate waveforms from magnetic sensors that are providedto an optional signal inversion module 104, which generates invertedversions of the waveforms. A signal processing module 106 implements ananalog algebraic manipulation of the waveforms. The signal manipulationmodule 106 generates a linear output voltage that is proportional toangular position. In one embodiment, the sensor is provided on a singlesilicon substrate.

FIG. 1A shows a magnetic sensor shown as an exemplary Hall effect device150 having a permanent magnet 152 with a first magnetic sensor 154 togenerate a sine wave and a second magnetic sensor 156 placed ninetydegrees from the first sensor to generate a cosine wave. The angularposition θ of the rotating magnet 152 can be determined from the sineand cosine signals to provide a linear sensor output. In an exemplaryembodiment, the sensor circuit has a 360° sensing range and operates ona single power supply.

In one embodiment, the sensor output is generated from the relationshipset forth in Equation 1 below:

$\begin{matrix}{{output} = \frac{{A\mspace{11mu}{\sin(\theta)}} + {offset}}{\frac{1}{k}\left( {{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}} \right)}} & {{Eq}\mspace{14mu}(1)}\end{matrix}$where output is the sensor output, A is the amplitude of the generatedsine and cosine signals, offset is the vertical offset of the sinusoidalsignals with respect to ground, and k is any real number, where kaffects the gain and vertical offset of the final sensor output. Ingeneral, the value for k should be set so that the mathematical value ofthe output falls within the desired operational range.

FIG. 2 shows modeled input sinusoidal signals and output for Equation 1.A sine wave 200 and cosine wave 202 are shown as well as an averagesignal 204 of the sine and cosine signals. The output signal 206(sin/(sin/2+cos/2) is also shown. Note that sin/(sin/2+cos/2) embodiesthe amplitudes and offsets associated with the sinusoids as described byEquation 1. As can be seen, Equation 1 produces an output signal 206with a high degree of linearity in a first region of about 315° to 135°if the relationships in Equations 2 and 3 below hold:

$\begin{matrix}{{offest} = \frac{supply\_ voltage}{2}} & {{Eq}\mspace{14mu}(2)} \\{A = {\frac{supply\_ voltage}{2} - {0.5\mspace{11mu}{volts}}}} & {{Eq}\mspace{14mu}(3)}\end{matrix}$In a second region of 135°-315°, the input sinusoids are inverted aroundthe offset voltage as compared to the first region. The illustratedmodel assumes that A=2 volts, offset=2.5 volts, and k=2.

Using these observations, the model for Equation 1 can be modified sothat the output signal has the same degree of linearity in both regionsand is periodic over the two regions. In one particular embodiment, thismodification is performed by inverting the waveforms if they fall withinthe range of 135°-315° (the second region), as shown in FIG. 3. Asshown, the sine waveform 200′, cosine waveform 202′, and average signal204′, are inverted in the range of 135° to 315°, which corresponds to−sin(θ)>cos(θ) where −sin(θ) refers to the inversion of the sine waveabout an offset voltage, sin(θ) and cos(θ) embody the amplitudes andoffsets associated with the sinusoids as described by Equation 1.Exemplary parameters are A=2 volts, offset=2.5 volts, and k=2.

As shown in FIG. 4, the inversion or second region of 135°-315° can beidentified using a region indicator 250, which can be provided as a bit,that indicates whether −sin(θ)>cos(θ), where −sin(θ) refers to theinversion of the sine wave about an offset voltage, sin(θ) and cos(θ)embody the amplitudes and offsets associated with the sinusoids. Asnoted above, the modified model of Equation 1 produces an output that isperiodic over a range of 180°. In order to provide a 360° sensing range,the first and second regions can be defined using the following:if −sin(θ)>cos(θ)

-   -   output region=0°-180° (first region where θ ranges from 315° to        135°) else    -   output region=180°-360° (second region where θ ranges from 135°        to 315°)        Alternatively, the region indicator 250 can be used to        vertically shift up the sensor output of the 180°-360° or second        region to create a linear ramp. The magnitude of the vertical        shift is dependent on the variable k.

FIG. 5 shows an exemplary circuit implementation for an analog positionsensor 200 in accordance with the present invention. The sensor 200includes exemplary implementations for the signal generation, signalinversion, and signal processing modules 102, 104, 106 of FIG. 1, whichare described in detail below.

FIG. 6 shows one circuit implementation of a signal generation module102 including first and second Hall effect devices 302, 304, each ofwhich includes a Hall plate 306 and an amplifier 308 having offset trimand gain trim inputs. Alternatively, gain and offset trim values can beadjusted, such as by automatic gain control and/or automatic offsetadjust. The first Hall effect device 302 outputs a sin(θ) signal and thesecond Hall effect device 304 outputs a cos(θ) signal, where θrepresents a position of the rotating magnet.

While the illustrated embodiment provides for the generation ofsinusoidal signals using linear Hall effect devices, a variety of othermagnetic sensors can be used, such as a magnetoresistor (MR), amagnetotransistor, a giant magnetoresistance (GMR) sensor, or ananisotrpic magnetoresistance (AMR) sensor. In addition, while sinusoidalwaveforms are shown, it is understood that other suitable waveforms canbe used to meet the needs of a particular application.

A first signal inverter 310 inverts the sin(θ) signal to provide a−sin(θ) signal (where −sin(θ) is inverted about an offset) and secondsignal inverter 312 inverts the cos(θ) signal to provide a −cos(θ)signal (where −cos(θ) is inverted about an offset). With the inverters310, 312, each of sin(θ), −sin(θ), cos(θ), and −cos(θ) signals areavailable to the signal inversion module 104 (FIG. 7). A comparator 314receives as inputs cos(θ) and −sin(θ) to generate a region indicator bit(inverted or non-inverted sin and cos signals as noted above). Thecomparator 314 implements the −sin(θ)>cos(θ) determination describedabove to generate the region indicator bit.

The signal generation module 102 also includes a regulated voltagesupply 316, e.g., 5V, and a bias reference voltage 318, e.g., 2.5V.While a supply voltage of 5V is used in an exemplary embodiment, theparticular voltage used can be varied while still meeting therelationships set forth in Equations (2) and (3) hold.

FIG. 7 shows an exemplary signal inversion module 104 circuitimplementation to invert the sinusoidal signals generated from themagnetic sensors 302, 304 (FIG. 6) in the 135°-315° (second) region. Inthe illustrative implementation, the original (sin(θ) and cos(θ))signals and the inverted signals (−sin(θ) and −cos(θ)) are provided asinputs to a 2-input analog multiplexer 350. The comparator 314 output,which can correspond to the region indicator bit 250 of FIG. 4, controlsthe output of the multiplexer 350. That is, the region indicator bit 250determines whether inverted or non-inverted signals are output from theanalog multiplexer 250. The multiplexer 250 outputs can be buffered withrespective amplifiers 352, 354 for input to the signal processing module106 (FIG. 8).

FIG. 8 shows an exemplary signal processing circuit 106 implementationthat uses a resistive divider having first and second resistors R1, R2to implement the gain factor k. Note that this for works because k=2 inthe exemplary embodiment, recalling that

$\begin{matrix}{{output} = \frac{{A\mspace{11mu}{\sin(\theta)}} + {offset}}{\frac{1}{k}\left( {{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}} \right)}} & {{Eq}\mspace{14mu}(1)}\end{matrix}$The point between the resistors R1, R2 provides (sin(θ)+cos(θ))/2. Thissignal is buffered and input to the analog multiplier 400. The sin(θ)signal is provided as a second input (numerator in Eq. 1) to the analogmultiplier 400, which provides implicit division using the analogmultiplier 400. It is understood that the circuit includes the waveforminversion for multi-region linearity in accordance with Equation 4.

In one particular embodiment, the analog multiplier 400 operates on asingle supply and assumes that ground is equal to mathematical zero. Itis understood that other circuit embodiments can operate with a varietyof voltages, e.g., 0.5V, as “ground” to avoid effects associated aroundvariance, for example. Note that this division operation only requirestwo-quadrant division (or multiplication), since both incoming signalsare assumed to be mathematically positive. The output from the analogmultiplier 400 is processed to provided gain and offset correction foroutput in a range of 0.5V to 4.5V, in the illustrated embodiment.

The circuits of FIG. 5 can be implemented on a single substrate usingprocesses and techniques well known to one of ordinary skill in the art

While the invention is primarily shown and described as implementing aparticular algebraic relationship to achieve an analog position sensoron a single substrate, it is understood that other algebraicrelationships can be implemented.

In another embodiment, an alternative algorithm can be implemented asdescribed below. Referring again to Equation 1,

$\begin{matrix}{{output} = \frac{{A\mspace{11mu}{\sin(\theta)}} + {offset}}{\frac{1}{k}\left( {{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}} \right)}} & {{Eq}\mspace{14mu}(1)}\end{matrix}$where output is the sensor output, A is the amplitude of the generatedsine and cosine signals, offset is the vertical offset of the sinusoidalsignals with respect to ground, and k is any real number, where kaffects the gain and vertical offset of the final sensor output.

To reflect inversion, Equation 1 can be mathematically represented asset forth in Equation 4:

$\begin{matrix}{{output} = \frac{{{\pm A}\mspace{11mu}{\sin(\theta)}} + {offset}}{{\frac{A}{k}\left( {{\pm \mspace{11mu}{\sin(\theta)}} \pm \mspace{11mu}{\cos(\theta)}} \right)} + {2{offset}}}} & {{Eq}.\mspace{14mu}(4)}\end{matrix}$or, as in Equation 5 below:

$\begin{matrix}{{output} = \frac{{A\mspace{11mu}{\sin(\theta)}} \pm {offset}}{{\frac{A}{k}\left( {{\sin(\theta)} + {\cos(\theta)}} \right)} \pm {offset}}} & {{Eq}.\mspace{14mu}(5)}\end{matrix}$The inversion is then applied, i.e. the “−” term when:

$\begin{matrix}{{{2{offset}} - \left( {{A\mspace{11mu}{\sin(\theta)}} + {offset}} \right)} > {{A\mspace{11mu}{\cos(\theta)}} + {{offset}\mspace{14mu}{or}}}} & {{Eq}.\mspace{14mu}(6)} \\{\frac{{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}}{2} < {offset}} & {{Eq}.\mspace{14mu}(7)}\end{matrix}$

To obtain an alternative form of the algorithm, Equation 5 can besimplified as follows:

Multiply numerator and denominator by

$\frac{k}{A}$to generate the result in Equation 8:

$\begin{matrix}{{output} = \frac{{k\mspace{11mu}{\sin(\theta)}} \pm \frac{k \times {offset}}{A}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(8)}\end{matrix}$Insert an add and subtract cos(θ) term in the numerator as shownEquation (9):

$\begin{matrix}{{output} = \frac{{k\mspace{11mu}{\sin(\theta)}} + {\cos(\theta)} - {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(9)}\end{matrix}$Insert an add and subtract sin(θ) term in the numerator per Equation 10.

$\begin{matrix}{{output} = \frac{{k\mspace{11mu}{\sin(\theta)}} - {\sin(\theta)} - {\cos(\theta)} + {\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(10)}\end{matrix}$Factor out sin(θ) from the “k sin(θ)−sin(θ)” term in the numerator as inEquation 11.

$\begin{matrix}{{output} = \frac{{\left( {k - 1} \right){\sin(\theta)}} - {\cos(\theta)} + {\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(11)}\end{matrix}$

Note the common

${{\,^{``}\sin}(\theta)} + {{\cos(\theta)} \pm {\frac{k \times {offset}}{A}''}}$in both the numerator and the denominator. Equation 11 can be rewrittenas in Equation 12:

$\begin{matrix}{{output} = {1 + \frac{{\left( {k - 1} \right){\sin(\theta)}} - {\cos(\theta)}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}}} & {{Eq}.\mspace{14mu}(12)}\end{matrix}$

Note that if one recognizes that the constant term “1” is a DC offset,then one can eliminate the offset since it will not change the overalllinearity of the output as in Equation 13.

$\begin{matrix}{{output} = \frac{{\left( {k - 1} \right){\sin(\theta)}} - {\cos(\theta)}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(13)}\end{matrix}$

Now consider that k is a constant that only affects the final gain andoffset of the output. This constant can be fixed so that k=2, as in theexample described above. This can be represented in Equation 14:

$\begin{matrix}{{output} = \frac{{\sin(\theta)} - {\cos(\theta)}}{{\sin(\theta)} + {{\cos(\theta)} \pm \frac{k \times {offset}}{A}}}} & {{Eq}.\mspace{14mu}(14)}\end{matrix}$Since sin(θ)+cos(θ)=√{square root over (2)} sin(θ+45°) andsin(θ)−cos(θ)=√{square root over (2)} sin(θ−45°), as is well known,Equation 14 can be rewritten as Equation 15:

$\begin{matrix}{{output} = \frac{\sqrt{2}{\sin\left( {\theta - {45{^\circ}}} \right)}}{{\sqrt{2}{\sin\left( {\theta + {45{^\circ}}} \right)}} \pm \frac{2 \times {offset}}{A}}} & {{Eq}.\mspace{14mu}(15)}\end{matrix}$Dividing the numerator and denominator of the right side of the equationby √{square root over (2)} results in the relationship of Equation 16:

$\begin{matrix}{{output} = \frac{\sin\left( {\theta - {45{^\circ}}} \right)}{{\sin\left( {\theta + {45{^\circ}}} \right)} \pm \frac{2 \times {offset}}{A}}} & {{Eq}.\mspace{14mu}(16)}\end{matrix}$Note that the sinusoidal term in the numerator, sin(θ−45°), differs fromthe sinusoidal term in the in the denominator, sin(θ+45°) by a phase of90°. Because of this, one can replace the numerator and denominator withsin(θ) and cos(θ) respectively, as shown in Equation 17 below:

$\begin{matrix}{{output} = \frac{\sin(\theta)}{{\cos(\theta)} \pm \frac{\sqrt{2} \times {offset}}{A}}} & {{Eq}.\mspace{14mu}(17)}\end{matrix}$This changes the inversion point (i.e. application of the “−” term) to:0>cos(θ). Also, the phase of the output is now aligned identically witharctangent rather than being out of phase with arctangent by 45°.

Note that the sinusoids now have unity gain: sin(θ) has zero offset,whereas cos(θ) has a finite offset (i.e., cos(θ) has an offset equal to

$\left. \frac{\sqrt{2} \times {offset}}{A} \right).$Since the variables A and offset no longer represent the real gain andoffset of the sinusoids one should identify this constant as a number,which can be referred to as b. Rewriting again results in therelationship set forth in Equation 18:

$\begin{matrix}{{output} = \frac{\sin(\theta)}{{\cos(\theta)} \pm b}} & {{Eq}.\mspace{14mu}(18)}\end{matrix}$The linearity of the output depends upon the value of the constant term.The previous example showed that A=2 and offset=2.5V. In astraightforward ‘guess’, the ideal constant term of b is approximatelyequal to 1.7678. The linearity of the output can be improved slightly byvarying the value of b. It will be appreciated that the relationship ofEquation 18 can be scaled as desired, such as to fit the originalspecifications above. If sin(θ) and cos(θ) have some gain, A, then theconstant b must also become a function of A as set forth in Equation 19:

$\begin{matrix}{{output} = \frac{A\mspace{11mu}{\sin(\theta)}}{{A\mspace{11mu}{\cos(\theta)}} \pm {Ab}}} & {{Eq}.\mspace{14mu}(19)}\end{matrix}$It is possible to know the value of A by using automatic gain control orusing the well known trigonometric relationship of Equation 20:A=√{square root over ((A sin(θ))²+(A cos(θ))²)}{square root over ((Asin(θ))²+(A cos(θ))²)}  Eq. (20)

FIG. 9 shows an exemplary sensor package 500 having an illustrativepinout of Vcc and Gnd with sin(θ) and cos(θ) pins, a region indicator,and position output signal. It will be appreciated that a variety ofpinout configurations are possible. In one embodiment, the sensorpackage includes a sensor on a single substrate 502.

For exemplary sensor implementations, it may be desirable to provide anoutput of the angle sensor that is ratiometric with the supply voltageso that it can interface with the LSB (least significant bit) of variouscircuits, such as ADCs (analog to digital converters). In order for theoutput of the division stage, such as the one described above, to beratiometric with the supply voltage, the following relationships can beapplied: k=0.4*Supply, A=0.4*Supply, and the offset=0.5*Supply. As longas these relationships hold, the sensor output will scaleratiometrically. Alternatively, assuming that Supply=5V, then if youonly allowed A and offset to be ratiometric, the output of the dividerstage will be exactly the same regardless of how low the supply drops(assuming it does not clip the output). Ratiometry can be achieved byscaling the output of the division stage by Supply/5. It is understoodthat ratiometry can be achieved using other mechanisms.

Implementing an analog sensor on a single substrate in accordance withexemplary embodiments of the invention provides smaller packages withfewer components as compared with convention sensors having digitalsignal processing cores. In one particular embodiment, a sensor includesAMR and circuitry on a single die. In other embodiments, angle sensorscan have multiple dies, such as for GMR, AMR, GaAs, and various siliconHall sensors. In one particular embodiment shown in FIG. 9A, an anglesensor includes multiple dies with a first die D1 in a CMOS process forthe circuits and a second die D2 providing a different Hall plate dopingfor the sensor. Other embodiments include one die with signal processingand two GaAs die and/or two MR die. It should be noted that the GMR dieact in a different plane of sensitivity so that the sensors need to bepositioned appropriately, for example closer to the center of the axisof rotation. In addition, manufacturing costs will be reduced and steadystate conditions will be reached sooner than in conventional devices.

In another aspect of the invention, an angle sensor increases sinusoidalfrequency to provide higher output resolution. It is known that rotatinga diametrically bipolar disc magnet above two 90° mechanically offsetmagnetic sensors will generate a sin/cosine signal pair as the output ofthe magnetic sensors. One 360° revolution of the magnet will correspondwith one period of the sine and cosine signals. By increasing thefrequency of the sinusoids over one 360° revolution, higher outputresolution is achieved in angle sensing.

As described above, a pair of sine/cosine signals for angle sensingapplications can be generated by placing two magnetic sensors at a 90°mechanical offset around the center of a rotating diametrically bipolardisc magnet. Placing two Hall plates at a 90° mechanical offset aroundthe center of a diametrically bipolar disc magnet produces a sine/cosinesignal pair.

When these two sinusoids are used as input to an angle-sensingalgorithm, such as the algorithm described above in Equation 1, theoutput appears as shown in FIG. 10. The maximum angular error of theoutput is calculated as follows in Equation 21:

$\begin{matrix}{V_{ERROR\_ MAX} = {{MAX}\left( {{\theta_{EXPECTED}(\theta)} - {\frac{{V_{OUT}(\theta)} - V_{OFFSET}}{V_{FULL\_ SCALE}} \times \theta_{RANGE}}} \right)}} & {{Eq}.\mspace{14mu}(21)}\end{matrix}$where θ_(EXPECTED) (θ) is the expected angular output at a given angleθ, V_(OUT)(θ) is the expected output voltage of the magnetic sensor at agiven angle θ, V_(OFFSET) is the offset of the output voltage, V_(FULL)_(—) _(SCALE) is the full scale voltage range of the output voltage, andθ_(RANGE) is the angular range of the output voltage ramp. The sine andcosine signals 600, 602 are shown as well as the output voltageV_(OUT)(θ) 604.

Observe in Equation 21 that the error is a function of the angular rangeof the output θ_(RANGE). The maximum angular error (V_(ERROR) _(—)_(MAX)) can be reduced if is θ_(RANGE) is decreased while the othervariables remain fixed.

It is possible to decrease θ_(RANGE) by increasing the frequency of thesinusoids over one 360° rotation of the magnet. If a ring magnet, forexample, is used in place of a diametrically bipolar disc magnet thenmore sinusoids can be generated in a single rotation. For example, if athree-pole pair magnet is used, then the frequency of the sinusoidsincreases by a factor of three, as shown in FIG. 11, and therefore,θ_(RANGE) decreases by a factor of three as shown in FIG. 12. Ifθ_(RANGE) decreases by a given factor, then V_(ERROR) _(—) _(MAX) willdecrease by the same factor. FIG. 11A shows an alternative embodimentshowing a multi-pole ‘donut’ magnet. Magnetization is radially outwardfrom the center.

In the configuration of FIG. 11, first and second sensors 650, 652 areoffset by ninety degrees on a ring magnet 654 having an odd number,i.e., three, of poles. FIG. 12 graphically shows signals for theconfiguration of FIG. 11. The sine, cosine and output V_(OUT) signals656, 658, 660, as well as θ_(RANGE) 662 and V_(OFFSET) 664.

The decrease in error is shown in the calculations of Equation 22 andEquation below.

$\begin{matrix}{V_{ERROR\_ MAX} = {{MAX}\left( {\frac{\theta_{EXPECTED}(\theta)}{3} - {\frac{{V_{OUT}(\theta)} - V_{OFFSET}}{V_{FULL\_ SCALE}} \times \frac{\theta_{RANGE}}{3}}} \right)}} & {{Eq}.\mspace{14mu}(22)} \\{V_{ERROR\_ MAX} = {\frac{1}{3}{{MAX}\left( {{\theta_{EXPECTED}(\theta)} - {\frac{{V_{OUT}(\theta)} - V_{OFFSET}}{V_{FULL\_ SCALE}} \times \theta_{RANGE}}} \right)}}} & {{Eq}.\mspace{14mu}(23)}\end{matrix}$It is understood that increasing the frequency of the sinusoids with aring magnet can be applied to any number of pole-pair combinations. Notethat a given ring magnet can have several different possible sensorplacements that generate the same sine(θ) and cos(θ) signals. Whileexemplary embodiments are shown and described as having a ring magnet,it is understood that other suitable devices can be used to generatewaveforms.

FIGS. 13 and 14 show exemplary magnetic sensor placements for a ringmagnet with two pole-pairs. FIG. 13 shows a ring magnet 700 having firstand second pole pairs. A first sensor 702 is placed at an intersectionof north/south, and the second sensor 704 is placed in the adjacentsouth pole for a separation of about forty-five degrees. FIG. 14 shows aring magnet 750 having a first sensor 752 at an intersection ofnorth/south poles and a second sensor in the non-adjacent south pole fora separation of about 135 degrees. As can be seen the resultant sine andcosines signals are the same for both configurations.

As described above, a region indicator bit can be used to distinguishtwo adjacent output ramps over a single period of the sinusoidal input.

In multi-pole embodiments, a region indicator bit can be used todistinguish the multiple output ramps over a 360 degree rotation of aring magnet. Using the region indicator bit as input to a counter, onecan determine the angular region of operation of the magnet. The countercan reset back to zero after cycling through all of the regions. Thisapproach will work as long as the device starts in a known angularregion (e.g. 0-90°, for the case of four regions of magnetization forthe “magnet”) and the magnet is rotated in one direction. If the magnetrotates in both directions it is possible to use an up/down counter inconjunction with a direction detection algorithm to determine the regionof operation. However, the device must start in a known angular region.

It is possible to calculate the number of output ramps generated by thering magnet (i.e. number of distinguishable regions) using Equation 24below with each ramp spanning an angular region given by Equation 25.

$\begin{matrix}{{{Number\_ of}{\_ regions}} = {2 \times \left( {{Number\_ of}{\_ Pole}{\_ Pairs}} \right)}} & {{Eq}.\mspace{14mu}(24)} \\{\theta_{RANGE} = \frac{360{^\circ}\;{MagnetRotation}}{{Number\_ of}{\_ Regions}}} & {{Eq}.\mspace{14mu}(25)}\end{matrix}$

For example, using Equation 24 one can calculate that a ring magnet withtwo pole pairs corresponds to four output ramps over one completerotation of the magnet. Each change in the bit state will correspondwith a change in region of 90° (from Equation 25). The regions ofoperation could be distinguished as set forth in Table 1 below

TABLE 1 Region of Operation Counter State Region of Operation 0  0-90° 1  90°-180° 2 180°-270° 3 270°-360°

As shown in FIG. 15, a region indicator bit distinguishes first andsecond ramps 802, 804 generated over one period of the sinusoidalsignal. If the region indicator bit is sent as input into a counter,then the counter can be used to distinguish the four 90° regions ofoperation over a 360° rotation of the magnet.

While exemplary embodiments discuss the use of a Hall effect sensor, itwould be apparent to one of ordinary skill in the art that other typesof magnetic field sensors may also be used in place of or in combinationwith a Hall element. For example the device could use an anisotropicmagnetoresistance (AMR) sensor and/or a Giant Magnetoresistance (GMR)sensor. In the case of GMR sensors, the GMR element is intended to coverthe range of sensors comprised of multiple material stacks, for example:linear spin valves, a tunneling magnetoresistance (TMR), or a colossalmagnetoresistance (CMR) sensor. In other embodiments, the sensorincludes a back bias magnet to sense the rotation of a soft magneticelement, and/or target.

In another aspect of the invention, signal processing circuitry requiredto increase the frequency of sinusoidal signals that are created byrotating a single pole magnet over Hall elements processes the outputvoltage from the magnetic sensors and generates signals of greaterfrequency that can be used to obtain a better resolution when applied toan angle sensing algorithm, such as that described above in Equation 1.

As described above, a linear output from the sine and cosine inputs canbe generated by rotating a single bipolar magnet over two individualHall elements. With a linearized signal, a change in y-volts in theoutput directly corresponds to x degrees of rotation. In accordance withexemplary embodiments of the invention, increasing the frequency of theinput sinusoids in turn increases the output resolution by increasingthe number of linear output ramps over a period of 360°.

It is mathematically possible to increase the frequency of inputsinusoids using the following trigonometric double angle identities:sin(2θ)=2 sin(θ)cos(θ)  Eq. (26)cos(2θ)=cos²(θ)−sin²(θ)  Eq. (27)If the doubled frequency signals produced by Equations 26 and 27 aresent as inputs into the angle sensing mechanism of Equation 1, theoutput will have four linear ramps over a revolution of 360°. Thisdoubling of linear ramps will result in a doubling of the overallresolution of the angle sensing.

The outputs are decoded to distinguish the four ramps between 0-90°,90°-180°, 180°-270°, and 270°-360°. The decoding could be done usingfour bits, for example, as shown in Table 1, below.

TABLE 1 Decoder Bits To Distinguish the Region of Operation of Each ofthe Output Ramps Angular Region Value of Decoder Bit 1 Value ofDecoderBit 2  0-90°  LOW LOW  90°-180° LOW HIGH 180°-270° HIGH LOW270°-360° HIGH HIGHIn an exemplary embodiment, decoder bit one can be generated as setforth below:

${\sin\left( {\theta + {22.5{^\circ}}} \right)} = {{{\frac{\sqrt{2}}{4}\left( {{\left( {1 + \sqrt{2}} \right){\sin(\theta)}} + {\cos(\theta)}} \right)\mspace{14mu}{if}\mspace{14mu}{\sin\left( {\theta + {22.5{^\circ}}} \right)}} > {{offset}\mspace{14mu}{Bit}\mspace{14mu} 1}} = {{{LOW}\mspace{14mu}{else}\mspace{14mu}{BIT}\mspace{14mu} 1} = {HIGH}}}$where offset is the vertical offset of the sinusoidal signals withrespect to mathematical zero (e.g. ground). Note that the complexity indetermining decoder bit one is a result of the −45° phase shift in theoutput of the previous angle sensing relationship. It is possible tochange the −45° phase shift, thus simplifying the comparison process, byusing a different form of the algorithm than described in Equation 1.

To generate the signal for decoder bit two in Table 1 above, thefollowing relationship can be utilized.

if −sin(2θ)>cos(2θ)

-   -   Bit 2=LOW

else

-   -   Bit 2=HIGH

FIG. 16 shows a timing diagram with respect to the output 1000 fordecoder bit one 1001 and FIG. 17 shows a timing diagram for decoder bittwo 1002.

FIG. 18 shows an exemplary schematic implementation 1010 of the anglesensing mechanism described above. The circuit 1010 includes a sineinput 1012 and a cosine input 1014. A region circuit 1016 generates thedecoder bit one. A algebraic circuit 1018 implements equations 26 and 27to provide sin(2θ) and cos(2θ) to an angle sensing circuit 1020, such asthe circuit shown in FIG. 5. The algebraic circuit 1018 generatescomponent signals sin(θ) and cos(θ), which are multiplied by two andcos²(θ) from which sin²(θ) is subtracted.

FIG. 19 shows a simulated output 1044 for the circuit of FIG. 18. Thesimulated input sine 1040 and cosine 1042 signals have frequencies of 1kHz. Note that increasing the frequency to increase resolution can beachieved with any fraction of input signals. For example:

$\begin{matrix}{{\sin\left( {\frac{3}{2}\theta} \right)} = {{\sin\left( {\theta + \frac{\theta}{2}} \right)} = {{{\sin(\theta)}\left( {\pm \sqrt{\frac{1 + {\cos(\theta)}}{2}}} \right)} + {{\cos(\theta)}\left( {\pm \sqrt{\frac{1 - {\cos(\theta)}}{2}}} \right)}}}} & {{Eq}.\mspace{14mu}(28)} \\{{\cos\left( {\frac{3}{2}\theta} \right)} = {{\cos\left( {\theta + \frac{\theta}{2}} \right)} = {{{\cos(\theta)}\left( {\pm \sqrt{\frac{1 + {\cos(\theta)}}{2}}} \right)} + {{\sin(\theta)}\left( {\pm \sqrt{\frac{1 - {\cos(\theta)}}{2}}} \right)}}}} & {{Eq}.\mspace{14mu}(29)}\end{matrix}$

The number of linear ramps in the output is proportional to thefrequency of the input; for the example using Equations 28 and 29 therewould be three linear output ramps. Decoding circuitry can distinguishthe region of operation for each of the linear ramps.

In a further aspect of the invention, an angle sensing output has anonlinear waveform that can be complemented with a second signal so thatan average of the two signals has an enhanced degree of linearity.

Equation 1 is copied below:

$\begin{matrix}{{output} = \frac{{A\mspace{11mu}{\sin(\theta)}} + {offset}}{\frac{1}{k}\left( {{A\mspace{11mu}{\sin(\theta)}} + {A\mspace{11mu}{\cos(\theta)}} + {2{offset}}} \right)}} & {{Eq}.\mspace{14mu}(1)}\end{matrix}$where output is the sensor output, A is the amplitude of the generatedsine and cosine signals, offset is the vertical offset of the sinusoidalsignals with respect to ground, and k is any real number. Where thewaveforms are inverted in a region to achieve the same degree oflinearity over 360 degrees (see Equation 4), the minus sign is appliedif −sin(θ)>cos(θ). Performing algebraic manipulations on Equation 1reveals that it can be expressed in a simpler mathematical form withouthindering its linearity properties set forth in Equation 30 below.

$\begin{matrix}{{output} = \frac{A\mspace{11mu}{\sin(\theta)}}{{A\mspace{11mu}{\cos(\theta)}} \pm {offset}}} & {{Eq}.\mspace{14mu}(30)}\end{matrix}$where output is the sensor output, A is the amplitude of the generatedsine and cosine signals, and offset is the vertical offset of cosinewith respect to ground. The minus sign is applied if cos(θ)<θ. Recallthat the output of Equations 1 and 30 is not truly linear, but has atheoretical best-case maximum error of ±0.33 degrees assuming that oneperiod of the input sinusoids corresponds with one 360 degree revolutionof a magnet.

One can choose a value for the value of the offset in Equation 30 thatgenerates a nonlinear waveform. It is possible to then generate a secondwaveform with complimentary nonlinearity to the first. In oneembodiment, this is performed by using a slightly modified version ofEquation 30 as shown in Equation 31 below. The average of the first andsecond waveforms can have a higher degree of linearity than thebest-case error of Equation 30 alone.

Consider Equation 30 above and Equation 31 below:

$\begin{matrix}{{output} = \frac{A\mspace{11mu}{\sin(\theta)}}{{{Ak}\mspace{11mu}{\cos(\theta)}} \pm {offset}}} & {{Eq}.\mspace{14mu}(31)}\end{matrix}$where k is a scaling factor. Note that A and offset have the same valuefor both equations. Choosing the values of k=0.309 and offset=1.02 Aproduce the waveforms shown in FIG. 20. The output 1100 of Equation 30and the output 1102 of Equation 31 show that their respectivenonlinearities compliment each other so that the average of the twowaveforms has a higher degree of linearity. The resulting output has abest-case maximum error of 0.029 degrees for the values of offset and kchosen above.

Averaging the waveforms 1100, 1102 results in an output with a best-casemaximum error of 0.029°. This is an order of magnitude less than withoutthe inventive complementary waveform averaging.

The final output is described by Equation 32 below:

$\begin{matrix}{{output} = {\frac{1}{2}\left( {\frac{A\mspace{11mu}{\sin(\theta)}}{{A\mspace{11mu}{\cos(\theta)}} \pm {offset}} + \frac{A\mspace{11mu}{\sin(\theta)}}{{{Ak}\mspace{11mu}{\cos(\theta)}} \pm {offset}}} \right)}} & {{Eq}.\mspace{14mu}(32)}\end{matrix}$where A is the amplitude of sine and cosine, offset is the offset ofcosine, and k is a scaling factor. Inversion is applied (i.e., minussign) when cos(θ)<θ. FIG. 21 below shows an exemplary implementation ofEquation 32 in circuitry.

Note that the same averaging technique described here could be performedon two waveforms generated by Equation 30 that have different offsets,as shown in Equation 33.

$\begin{matrix}{{output} = {\frac{1}{2}\left( {\frac{A\mspace{11mu}{\sin(\theta)}}{{A\mspace{11mu}{\cos(\theta)}} \pm {offset1}} + \frac{A\mspace{11mu}{\sin(\theta)}}{{{Ak}\mspace{11mu}{\cos(\theta)}} \pm {offset2}}} \right)}} & {{Eq}.\mspace{14mu}(33)}\end{matrix}$

For example if offset1=1.36 and offset2=4.76, then the output ofEquation 33 would have an error of about +0.15°.

In another aspect of the invention, a circuit integrates two magneticsensors and the signal processing circuitry required to generate a thirdsinusoidal signal that is derived from the two sensor outputs. Using thethree signals, the phase difference between two of the sinusoidalsignals is trimmed. Trimming the phase difference between two sinusoidalsignals can be advantageous in angle sensing, gear tooth sensing, andother applications. This feature is particularly advantageous whentrimming out sensor misalignments as a result of:

-   -   Manufacturing placement tolerances during final sensor        installation (i.e., misalignment of a disk magnet relative to an        angle sensor)    -   Manufacturing placement tolerances that affect the relative        placement of two Hall or MR sensors that do not reside on a        single substrate. This would be advantageous in the case where a        silicon signal processing die is interfaced with two or more        GaAs Hall plates or MR (magnetoresistive sensors).

The conventional approach for generating a pair of sine/cosine signalsrequired for angle sensing applications is to place two Hall plates at a90° mechanical offset around the center of a rotating magnet. Adisadvantage of this approach is that any misalignment in the 90°mechanical offset of the Hall plates results in a phase error betweenthe sin and cosine signals. The primary source of mechanicalmisalignment comes from the end user's inability to precisely align themagnet above the device package. For example, a magnet placementmisalignment of five mils can result in a phase error of up to about±8.33°. Such a phase error translates to an angular error ofapproximately ±8° for arctangent algorithms. Phase error is one of theleading sources of error in angle sensing algorithms.

In accordance with exemplary embodiments of the invention, the phasedifference between a Hall/MR generated sine/cosine signal pair istrimmed, as described in detail below. Note that this trimming may bedifficult to implement when cos(θ) is constructed using ninety degreeoffset sensors.

The relationships in Equations 34, 35 and 36 can be exploited toproviding trimming in accordance with exemplary embodiments of theinvention.

$\begin{matrix}{{C\mspace{11mu}{\sin\left( {\theta + \gamma} \right)}} = {{A\mspace{11mu}{\sin\left( {\theta + \alpha} \right)}} + {B\mspace{11mu}{\sin\left( {\theta + \beta} \right)}}}} & {{Eq}.\mspace{14mu}(34)} \\{C = \sqrt{A^{2} + B^{2} + {2{AB}\mspace{11mu}{\cos\left( {\alpha + \beta} \right)}}}} & {{Eq}.\mspace{14mu}(35)} \\{\gamma = {{\arccos\left( \frac{{A\mspace{11mu}{\cos(\alpha)}} + {B\mspace{11mu}{\cos(\beta)}}}{C} \right)}{{sgn}\left( \frac{{A\mspace{11mu}{\sin(\alpha)}} + {B\mspace{11mu}{\sin(\beta)}}}{C} \right)}}} & {{Eq}.\mspace{14mu}(36)}\end{matrix}$where A, B and C are the gains of their respective sinusoids, and α, β,γ are their phases. An exemplary technique for constructing cos(θ) isdescribed in the below.

As shown in FIG. 22, initially first and second Hall signals S₁ and S₂are generated by respective Hall elements 1200, 1202. Let S₁=A sin(θ),where A is some arbitrary gain. Note that it is assumed that A sin(θ) isa reference signal and therefore it has no phase error associated withit. Let S₂=A sin(θ+β) where 90°<β<180°. For example, if A=1 and β=125′,then S₁=sin(θ) and S₂=sin(θ+125°). Generate S₂ by placing the secondHall at a mechanical phase offset with respect to S₁.

The two generated signals can be related to cosine using Equations 37,38, and 39 below.

$\begin{matrix}{{C\mspace{11mu}{\cos(\theta)}} = {{A\mspace{11mu}{\sin(\theta)}} + {{GA}\mspace{11mu}{\sin\left( {\theta + \beta} \right)}}}} & {{Eq}.\mspace{14mu}(37)} \\{G = {- \frac{1}{\cos(\beta)}}} & {{Eq}.\mspace{14mu}(38)} \\{C = {A\sqrt{\frac{1}{\cos^{2}(\beta)} - 1}}} & {{Eq}.\mspace{14mu}(39)}\end{matrix}$where G is a gain factor and C is the amplitude of the resulting cosinesignal.

The second signal S₂ can be gained by G. Where β=125″, one can calculate(Equation 38) that G=1.74. As a result, S₂=1.74 sin(θ+125°), as shown inFIG. 23.

Now let S₃=S₁+S₂. As Equation 37 dictates, S₃=C cos(θ), where C can becalculated using Equation 39. In the example, C=1.43, so S₃=1.43 cos(θ),as shown in FIG. 24 where A sin(θ) and Ga sin(θ+β) are added to get Ccos(θ).

The third signal S₃ is then attenuated so that its amplitude matchesthat of the first signal S₁. This produce S₁=sin(θ) and S₃=cos(θ), asshown in FIG. 25.

After constructing the phase-shifted cosine signal as above, the phaseof the cosine can be trimmed. Cosine was constructed by adding thesignals generated from rotating a magnet over two mechanically offsetHall elements. Assume that S₁ (which equals A sin(θ)) has no phase errorassociated with it because it is a reference signal. The phase of S₃ isdetermined by both the phase β of S₂ and the gain factor G of S₂. S₃=Csin(θ+γ) where γ is given in Equation 40 below.

$\begin{matrix}{\gamma = {\arccos\left( \frac{1 + {G\mspace{11mu}{\cos(\beta)}}}{\sqrt{G^{2} + {2G\mspace{11mu}{\cos(\beta)}} + 1}} \right)}} & {{Eq}.\mspace{14mu}(40)}\end{matrix}$

Ideally γ is equal to 90′ since C sin(θ+90°)=C cos(θ).

It is known that S₂ might have a phase error due to magnet misalignment,and its phase error will directly affect the phase of S₃. However, it ispossible to trim out error in the phase of S₃ by adjusting the gain ofS₂, as shown in the example below.

EXAMPLE

Assume that it is expected to generate the following signals:S ₁=sin(θ)S ₂ =G sin(θ+125°=1.74 sin(θ+125°)S ₃ =C sin(θ+90°=1.43 sin(θ+90°=1.43 cos(θ)But due to magnet misalignment the following results:S ₁=sin(θ)S ₂=1.74 sin(θ+115°)S ₃=2.14 sin(θ+80.54°)The phase of S₃ can be ‘fixed’ by changing the gain of S₂. Instead ofhaving G=1.74, let G=2.37. This will make S₂=2.37 sin(θ+115°) andS₃=2.14 sin(θ+90°).

FIG. 26 shows how the gain factor G affects the output phase γ, for afew choices of β, which is the mechanical offset of S₂ with respect toS₁. The steeper the output curve is around 90°, the easier it is to finetune γ via changing the gain factor G. In other words, for steepercurves around 90°, gain error has less impact on the final output angle.This is calculated in Table 1, below, which summarizes the effect of theinput phase β on the ability to construct a 90° phase shifted signal.

TABLE I As the input phase β decreases, the angle resolution increases.The angle resolution is calculated assuming that the gain factor G canbe achieved to within ±1%. Actual Phase β of Ideal Value of CalculatedValue of Phase Error from Sensors Gain Factor G Output Gain C Ideal 90° 95° 11.474  11.430 A ±0.06° 105° 3.864 3.732 A ±0.16° 115° 2.366 2.145A ±0.28° 125° 1.743 1.428 A ±0.44° 135° 1.414 A ±0.59° 145° 1.221 0.700A ±0.83° 155° 1.103 0.466 A ±1.29°In a practical application, perhaps the best choice for β is 115′. Theworst-case accuracy of the phase of cosine would be ±0.44° assuming thatβ<±10″. The next step is to regulate the gain of C so that it matches A.This mathematical process of constructing cosine is implemented inexemplary circuitry in FIG. 27. A cosine signal is generated from twoinput Hall signals A sin(θ) and AG sin(θ+β). To adjust for phasemisalignment in β, the gain stage should be regulated. This exampleassumes that A=0.5 V, G=2.366 and β=115′.

The same technique used to trim the phase of cosine can be applied totrimming the phase of sine. More particularly, rearranging Equation 39produces the result in Equation 41:S ₁ =S ₃ −S ₂ or,A sin(θ)=C cos(θ)−GA sin(θ+β)  Eq. (41)

To phase shift A sin(θ) one can add another gain stage to the output ofS₂ and then apply Equation 41. Consider the following:S₄=X S₂YA sin(θ+α)=C cos(θ)−XGA sin(θ+β)  Eq. (42)where X and Y are gain factors and α is the angle shifted. Thesevariables can be calculated using the same principles found above forthe cosine. FIG. 28 shows how the phase regulation of A sin(θ) can beadded to the cosine construction circuitry of FIG. 27

In another aspect of the invention, a single waveform, which can besinusoidal, is used to generate a corresponding cosine signal. As isknown in the art, one obstacle in developing an angle sensing circuit islinearizing the sinusoidal inputs without relying on the memory of aprevious state. As described above, a linear output can be provided fromtwo sinusoidal inputs, e.g., sine and cosine signals are generated fromrotating a single pole magnet over two spatially phase shifted Hallelements. In exemplary embodiments of the invention, trigonometricidentities are applied to a single sinusoidal input in order toconstruct its corresponding cosine signal. In one embodiment, a trianglewave is generated that corresponds to the input sinusoid. The generationof this triangle wave does not require any memory of a previous state.

Taking advantage of the trigonometric identity sin²(θ)+cos²(θ)=1, whichcan be written as in Equation 42:A ² sin²(θ)+A ² cos²(θ)=A ²  Eq. (42)where A is a gain factor and θ is angular position, one solve for theabsolute value of cos(θ). Rearranging Equation 42 produces the result inEquation 43:|A cos(θ)|=+√{square root over (A ² −A ² sin²(θ))}  Eq. (43)which provides rectified cos(θ). A true cos(θ) signal cannot becalculated directly because the squaring terms in this identity make allvalues positive. To calculate true cos(θ) requires an indicator bit thatwill invert the rectified signal at the appropriate points.

As shown above, a linear output can be calculated using a rectifiedsinusoidal signal. A sinusoidal input can be linearized by constructingits corresponding cosine signal. Initially, a sinusoidal input A sin(θ)is provided, as shown in FIG. 29. The sinusoid is manipulated, as shownin FIG. 30, to have the form A² sin²(θ). Then |A cos(θ)| can becalculated as shown in FIG. 31. The next step gains A sin(θ) and |Acos(θ)| by a constant, G to adhere to rules in Equations 44 and 45.

An inverted “cane” waveform, shown in FIG. 33, is generated by adding GAsin(θ) to G|A cos(θ)|. The cane waveform will be larger than the GAsin(θ) and G|A cos(θ)| by a factor of √{square root over (2)} by virtueof the addition operation. As shown in FIG. 34, the rectified G|Acos(θ)| can be divided by the “cane” waveform the output of which can betrimmed in output gain and offset accordingly. The output waveformcorresponds with the peaks and troughs of the originating sinusoid.

For optimal results in an exemplary embodiment, the relationships inEquations 44 and 45 should be true:GA=0.596(offset)  Eq. (44)offset≠0  Eq. (45)where G is the gain factor described above and offset is the verticaloffset of the sinusoidal signals with respect to mathematical zero (e.g.ground). In an ideal case where there are no error sources, the minimumnonlinearity is 0.328°. This procedure for linearizing a sinusoid can beimplemented in circuitry, such as the exemplary circuit shown in FIG.35. The output of the circuit is shown in the simulated results of FIG.36 for the input sinusoid 1300 and the triangular output 1302. For thisexample the input sinusoid has a frequency of 1 kHz.

To utilize this algorithm in a 360 degree angle sensing application amethod of identifying the negatively sloped portion of the output isrequired. However, this would not be required for a 180 degree sensor.This identification can be in the form of an indicator bit that willinvert the negatively sloped portion and distinguish the 0-180° regionfrom the 180°-360° region. This indicator bit may take the form of anadditional magnetic field sensor that is used to identify the polarityof the magnetic field, i.e., north or south. Without this indicator bitthe algorithm would only be capable of a range of 0-180°. Notice thatthe output differs from the mechanism of Equation 1 in that the phase ofthe output has a −90° phase shift rather than a −45° phase shift. Thephase shift for an embodiment of Equation 1 considered 0° to be thepoint where the output was at a minimum.

In another aspect of the invention, the gain and offset of the inputsinusoids is controlled in order to reduce the final output error.Automatic Gain Control (AGC) and Automatic Offset Adjust (AOA) can beapplied to the angle sensing embodiments described above. For example,one embodiment uses offset adjustment DACs (digital-to-analog) and gaincell transconductors that accept an input current from a current DAC tocontrol the gain of an amplifier. U.S. Pat. No. 7,026,808, No.6,919,720, and No. 6,815,944, which are incorporated herein by referenceshows exemplary AGC circuits, and U.S. patent application Ser. No.11/405,265, filed on Apr. 17, 2006, which are incorporated herein byreference, disclose exemplary AOA embodiments.

In another embodiment, a circuit having gain control relies on the factthat the inputs are A₁ sin(θ) and A₂ cos(θ), where A₁ and A₂ are thegain values of the signals. If one assumes the signals have matchinggains, (i.e. A₁=A₂=A) one can implement into circuitry the trigonometricidentity A=√{square root over ((A sin(θ))²+(A cos(θ))²)}{square rootover ((A sin(θ))²+(A cos(θ))²)} to solve for the actual gain, A. Scalingthe sinusoids by some factor of A (where A is calculated using theequation above) will result in a final constant gain regardless ofvariations due to air gap displacement. This method of gain control iseffective for signals with zero offset and matching gains, and it can beused in conjunction with other AGC methods.

It is understood that gain and offset can be trimmed at end of line testand/or at customer final test, for example. It can also be adjusted atdevice power up or change dynamically during running mode.

If dynamic adjustment of gain and offset is desired during operation thedevice can have a calibrate pin that enables or disables the adjustmode. This pin could also control the update speed in which the AGC andAOA corrections are applied to the output. The update frequency could becontrolled by a timing mechanism or correspond with the falling edgetransition of the algorithm's final output ramp.

FIGS. 37 and 38 show an exemplary technique for controlling the speed ofthe AGC and AOA during running mode via a timing mechanism. An externalcapacitor C on a calibrate pin CAL charges the central node. When thevoltage on the capacitor C reaches V_(REF), a comparator CO trips anddischarges the capacitor. The comparator CO output will pulse highmomentarily. AOA and AGC corrections can be updated whenever thecomparator pulses high. Choosing different size capacitors can controlthe speed of the comparator pulses. Tying the CAL pin LOW will shut offthe dynamic updating mode.

One skilled in the art will appreciate further features and advantagesof the invention based on the above-described embodiments. Accordingly,the invention is not to be limited by what has been particularly shownand described, except as indicated by the appended claims. Allpublications and references cited herein are expressly incorporatedherein by reference in their entirety.

1. A sensor, comprising: a magnetic position sensing element to generate angular position information; a first signal generator to generate a first waveform corresponding to the angular position information; a second signal generator to generate a second waveform corresponding to the angular position information, wherein the first and second waveforms are offset by a predetermined amount; a first inverter to invert the first waveform for providing a first inverted waveform and a second inverter to invert the second waveform for providing a second inverted waveform, wherein the first and second waveforms are inverted about an offset voltage; and an analog signal processing module to generate a linear output signal from the first waveform, the second waveform, the first inverted waveform, and the second inverted waveform.
 2. The sensor according to claim 1, wherein the first and second waveforms are used by the signal processing module in a first region and the first inverted waveform and the second inverted waveform are used in second region to generate the linear output signal.
 3. The sensor according to claim 2, wherein the first region corresponds to about 180 degrees of angular position for the position sensing element.
 4. The sensor according to claim 2, further including a region indicator for the first and second regions.
 5. The sensor according to claim 1, wherein the magnetic sensor includes a magnet having a plurality of pole-pairs to reduce a maximum angular error of the magnetic sensor.
 6. The sensor according to claim 1, further including providing the sensor on first and second dies. 